		<div class="admin-main">

			<blockquote class="layui-elem-quote">
				
				<a href="javascript:;" class="layui-btn layui-btn-small" id="export">
					<i class="fa fa-area-chart"></i>立即备份
				</a>
				<a href="javascript:;" class="layui-btn layui-btn-small" id="optimize" attr="opt">
					<i class="fa fa-hourglass-start"></i>优化表
				</a>
				<a href="javascript:;" class="layui-btn layui-btn-small" id="repair" attr="rep">
					<i class="fa fa-gavel"></i>修复表
				</a>
				<a href="__URL__/down" class="layui-btn layui-btn-small">
					<i class="fa fa-download"></i>下载
				</a>
				<a href="__URL__/index" class="layui-btn layui-btn-danger layui-btn-small" id="add">
					<i class="fa fa-refresh"></i> 刷新
				</a>
			</blockquote>
			<form id="export-form" method="post" action="{:U('export')}">
			<fieldset class="layui-elem-field">
				<legend>数据列表</legend>
				<div class="layui-field-box">
					<table class="site-table table-hover">
						<thead>
							<tr>
								<th><input type="checkbox" checked id="selected-all"></th>
								<th>表名</th>
								<th>数据量</th>
								<th>数据大小</th>
								<th>创建时间</th>
								<th>备份状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<volist name="list" id="table">
							<tr>
								<td><input type="checkbox" name="tables[]" value="{$table.name}" checked ></td>
								<td>{$table.name}</td>
								<td>{$table.rows}</td>
								<td>{$table.data_length|format_bytes}</td>
								<td>{$table.create_time}</td>
								<td class="info">未备份</td>
								<td class="action">
								   <a class="layui-btn layui-btn-normal layui-btn-mini" href="__URL__/export/tables/{$table.name}">备份表</a>&nbsp;

								   <a class="layui-btn layui-btn-mini" href="__URL__/optimize/tables/{$table.name}">优化表</a>&nbsp;

								   <a class="layui-btn layui-btn-danger layui-btn-mini" href="__URL__/repair/tables/{$table.name}">修复表</a>
								</td>
							</tr>
							</volist>
						</tbody>
					</table>

				</div>
			</fieldset>
			</form>
			<div class="admin-table-page">
				<div id="page" class="page">
					{$page}
				</div>
			</div>
		</div>
		<script type="text/javascript" src="__PUBLIC__/admintpl/plugins/layui/layui.js"></script>
		<script>
			layui.config({
				base: '__PUBLIC__/admintpl/plugins/layui/modules/'
			});

			layui.use(['icheck','layer'], function() {
				var $ = layui.jquery,
					
					layer = parent.layer === undefined ? layui.layer : parent.layer;
				
				$('input').iCheck({
					checkboxClass: 'icheckbox_flat-green'
				});

				

				var $form     = $("#export-form");
				var $repair   = $("#repair");
				$("#optimize").add($repair).click(function(){
					
					if($(this).attr('attr')=='opt'){
						var src = "{:U('Database/optimize')}";
						var dastr = "优化";
					}
					if($(this).attr('attr')=='rep'){
						var src = "{:U('Database/repair')}";
						var dastr = "修复";
					}
					layer.alert("数据表"+dastr+"中，请等待....");
					$.post(src, $form.serialize(), function(data){
						if(data.status){
							layer.alert(data.info,{icon:1,title:'提示'});
						} else {
							layer.alert(data.info,{icon:2,title:'提示'});
						}
					}, "json");
					return false;
				});
				
				$("#export").click(function(){
					layer.alert("数据表备份中，请等待....");
					$.post("{:U('Database/export')}", $form.serialize(), function(data){
						if(data.status){
							layer.alert(data.info,{icon:1,title:'提示'});
						} else {
							layer.alert(data.info,{icon:2,title:'提示'});
						}
					}, "json");
					return false;
				});

				$('.site-table tbody tr').on('click', function(event) {
					var $this = $(this);
					var $input = $this.children('td').eq(0).find('input');
					$input.on('ifChecked', function(e) {
						$this.css('background-color', '#EEEEEE');
					});
					$input.on('ifUnchecked', function(e) {
						$this.removeAttr('style');
					});
					$input.iCheck('toggle');
				}).find('input').each(function() {
					var $this = $(this);
					$this.on('ifChecked', function(e) {
						$this.parents('tr').css('background-color', '#EEEEEE');
					});
					$this.on('ifUnchecked', function(e) {
						$this.parents('tr').removeAttr('style');
					});
				});
				$('#selected-all').on('ifChanged', function(event) {
					var $input = $('.site-table tbody tr td').find('input');
					$input.iCheck(event.currentTarget.checked ? 'check' : 'uncheck');
				});
			});
		</script>